home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12425 < prev    next >
Encoding:
Text File  |  1996-08-05  |  854 b   |  34 lines

  1. Newsgroups: comp.lang.c++
  2. Path: howland.reston.ans.net!torn!news!apollo!saed
  3. From: saed@engn.uwindsor.ca (Saed Aryan,13325,1100,g)
  4. Subject: Dynamic Casting / RTTI
  5. X-Nntp-Posting-Host: apollo.engn.uwindsor.ca
  6. Message-ID: <DoJF68.Mx8@news.uwindsor.ca>
  7. Keywords: dynamic casting, rtti
  8. Sender: news@news.uwindsor.ca (Usenet)
  9. Reply-To: saed@engn.uwindsor.ca
  10. Organization: VLSI Research Group - University of Windsor
  11. Date: Tue, 19 Mar 1996 23:13:20 GMT
  12.  
  13.  
  14. Hi All,
  15.  
  16. given the following code:
  17.  
  18. class Base{};
  19. class Deri : public Base{};
  20. main(){  Base * pB = new Deri; };
  21.  
  22. --- How do can I obtain a 'Deri' class pointer to the same object as pB?
  23.  
  24. sort of like: Deri * pD = dynamic_cast<Deri*>(pB);
  25. but this yields an error: 
  26. cannot dynamic_cast `pB' (of type `class Base *') to type `class Deri *'
  27.  
  28. Lots of thanks in advance,
  29.  
  30. Aryan        saed@engn.uwindsor.ca
  31.  
  32.  
  33.  
  34.